package GUI;
/**
 * Open new semester screen for the adminnistration user type
 */

import java.awt.Dimension;

import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JFormattedTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class OpenNewSemester extends JPanel {
	private JButton btnOpenNewSemester = null;
	private JLabel lblOpenNewSemester = null;
	private JLabel lblStartDate = null;
	private JLabel lblEndDate = null;
	public Login myLoginFrame=null;
	public AdminMainMenu amn = null;
	public  UserAdmin user = null;
	
	
	
	private JButton getOpenNewSemesterBtn()
	{
		if(btnOpenNewSemester==null)
		{
			btnOpenNewSemester = new JButton("Open new semester");
			btnOpenNewSemester.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					//TODO what happends when admin clicks open new semester
					user.Executed=false;
					amn.myLoginFrame.client.handleMessageFromClientUI("CreateNewSemester");
					while(!user.Executed);
					
				}
			});
			btnOpenNewSemester.setBounds(251, 160, 202, 65);
			
		}
		return 	btnOpenNewSemester;
		
	}
	
	
	private void initialize(AdminMainMenu adminFrame)
	{
		
		setLayout(null);
		lblOpenNewSemester = new JLabel("Open new semester");
		lblOpenNewSemester.setBounds(310, 11, 96, 14);
		
		this.add(lblOpenNewSemester);
		
		
		this.add(getOpenNewSemesterBtn());
	}
	
	
	
	
	public OpenNewSemester(AdminMainMenu adminFrame)
	{
		super();
		initialize(adminFrame);
		
		
	}
}
